// 问题
const mongoose = require('mongoose')
const QuestionsSchema = new mongoose.Schema({
    // 标题
    title: {
        type: String,
        required: true
    },
    // 描述
    description: {
        type: String
    },
    __v: {
        type: Number,
        select: false
    },
    // 提问者
    // 提问者-问题 一对多关系
    questioner: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Users',
        required: true,
        select: false
    },
    // 问题的话题列表
    // 问题-话题 多对多关系
    topics: {
        type: [{
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Topics',
        }],
        select: false
    }


}, {timestamps: true})
module.exports = mongoose.model('Questions', QuestionsSchema)
